package com.example.partner.controller;

import com.example.partner.pojo.User;
import com.example.partner.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;

@Controller
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping(value="/log")
    public String Log(String username, Model model){
        System.out.println(username);
        User user = userService.getOneUserByName(username);
        model.addAttribute("user",user);
        System.out.println(user.getHead());
        return "my";
    }

    @RequestMapping("/index")
    public String toindex(){
        return "/fangwen.html";
    }
}